<?php

/*
class ViewHandler, controller for operating with a view
Copyright (C) 2011  Petr Čermák

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

require_once 'View.php';
require_once 'Request.php';
require_once 'PhpTemplate.php';
require_once 'ActionHandler.php';

class ViewHandler extends Controller{

    protected $view = null;

    /**
     * Returns view associated with this controller
     * @return View
     */
    public function getView(){return $this->view;}
    public function setView(View $view){$this->view = $view;}
    public function setPhpTemplateName($view){$this->view = new PhpTemplate($view);}

    public function processRequest(){
        //parent::processRequest();
        //if($this->view != null)$this->view->render();
        $this->processHelpers();
        $this->processAndView();
    }

    public function processAndView(){
        $this->process();
        if($this->view != null)$this->view->render();
    }

    //protected function process(){parent::process();}

}
?>
